added Feb 2001 SDK
[windows-sources.git] / shared source / sscli20 / tools / bin / binplace.cmd
blobbd87ddeea6a62693d2037036312cdb0e1cfeb69c
1 @if "%_echo%"=="" echo off
2 REM ==++==
3 REM
4 REM
5 REM Copyright (c) 2006 Microsoft Corporation. All rights reserved.
6 REM
7 REM The use and distribution terms for this software are contained in the file
8 REM named license.txt, which can be found in the root of this distribution.
9 REM By using this software in any fashion, you are agreeing to be bound by the
10 REM terms of this license.
11 REM
12 REM You must not remove this notice, or any other, from this software.
13 REM
14 REM
15 REM ==--==
16 setlocal
17 if "%FEATURE_PAL%"=="1" goto UseMe
18 if not exist %NTMAKEENV%\binplace.exe goto UseMe
19 call %NTMAKEENV%\binplace.exe %*
20 goto End
22 :UseMe
23 REM Calculate the directory and full qualifed file name from the input
24 REM echo %*
26 REM Look for -R to find destination directory
27 :Shift
28 if "%1"=="-R" goto FoundDestination
29 if "%1"=="" goto InvalidCommand
30 shift
31 goto shift
33 :FoundDestination
34 set DestinationDir=%2
36 REM Not look for the last parameter
37 :Shift2
38 if "%2"=="" goto FoundLast
39 shift
40 goto Shift2
42 :FoundLast
43 set QualifiedFileName=%1
45 REM Calculate the Path for the sourcefile to copy
46 call :ComputeFilePath %QualifiedFileName%
47 set SourcePath=%RESULT%
49 REM Calculate the Source File (without extension)
50 call :ComputeFileName %QualifiedFileName%
51 set SourceFile=%RESULT%
53 REM Calculate the File Extension
54 call :ComputeExtension %QualifiedFileName%
55 set Extension=%RESULT%
57 REM Copy the file
58 echo Copying %QualifiedFileName% to %DestinationDir%
59 if not exist %DestinationDir% md %DestinationDir%
60 copy %QualifiedFileName% %DestinationDir%
61 if exist %QualifiedFileName%.manifest copy %QualifiedFileName%.manifest %DestinationDir%
63 REM If the <file>.pdb exist, copy it over as well
64 if not exist %SourcePath%%SourceFile%.pdb goto PDBCopyDone
65 if /i "%Extension%"==".dll" set SymbolDestination=%DestinationDir%\Symbols\dll
66 if /i "%Extension%"==".exe" set SymbolDestination=%DestinationDir%\Symbols\Exe
68 if "%SymbolDestination%"=="" goto PDBCopyDone
69 if not exist %SymbolDestination% md %SymbolDestination%
70 echo Copying %SourcePath%%SourceFile%.pdb to %SymbolDestination%
71 copy %SourcePath%%SourceFile%.pdb %SymbolDestination%
72 :PDBCopyDone
74 REM We're done!
75 Goto End
77 REM Various useful expansion codes
79 REM ------------------------------------------
80 REM Expand a string to a full path
81 REM ------------------------------------------
82 :FullPath
83 set RESULT=%~f1
84 goto :EOF
86 REM ------------------------------------------
87 REM Compute the Path for the given input
88 REM ------------------------------------------
89 :ComputeFilePath
90 set RESULT=%~p1
91 Call :FullPath %RESULT%
92 goto :EOF
94 REM ------------------------------------------
95 REM Compute the filename for the given input
96 REM ------------------------------------------
97 :ComputeFileName
98 set RESULT=%~n1
99 goto :EOF
101 REM ------------------------------------------
102 REM Compute the Path for the given input
103 REM ------------------------------------------
104 :ComputeExtension
105 set RESULT=%~x1
106 goto :EOF
108 REM ------------------------------------------
109 REM Invalid command
110 REM ------------------------------------------
111 :InvalidCommand
112 echo Invalid command
113 goto :EOF
115 :End
116 endlocal